from lib.utils import Logger, DummyLogger
from lib.database_qzone import Database as Database_qzone
from crawlqzone_new import Bot
from classify import makeQzoneWorker
class MyBot(Bot):
    def run(self):
        self.doit()

def crawl_specific(logpath = None, type='qzone', uid=None):
    if uid:
        logger = Logger(logpath) if logpath else DummyLogger(logpath)
        if type == 'qzone':
            dal = Database_qzone()
            bot = MyBot(uid, logger, dal)
            #bot.start()
            bot.doit()
            u = dal._queryOneUser(uid)
            target = makeQzoneWorker(u, useapp=True, force=True)
            target()
        elif type == 'msn':
            pass

#crawl_specific(uid='')
